﻿@model IEnumerable<Codapalooza.Models.Project>
@{
  ViewBag.Title = "Index";
}
<h1>
  Index</h1>
<p>
  @Html.ActionLink("Proposer un nouveau projet", "Create")<br />
  Ou votez pour votre projet pr&eacute;f&eacute;r&eacute;
</p>
<table width="100%">
  @foreach (var item in Model)
  {
  <tr>
    <td width="50px">
    @if (item.CanEdit)
    {
        @Html.ActionLink("Edit", "Edit", new { id = item.Id }) <br />
        @Html.ActionLink("Delete", "Delete", new { id = item.Id }) <br />
    }
    @if (item.Votes.Any(v => v.Participant.UserName == User.Identity.Name))
    {
      <span>Vot&eacute;</span>
    }
    else
    {
      @Html.ActionLink("Vote", "Vote", new { id = item.Id })
    }
    </td>
    <td>
      <span style="font-size: 16pt">@Html.ActionLink(item.ProjectName, "Details", new { id = item.Id })</span> <span>(Votes : @item.Votes.Count)</span><br />
      <span style="font-size: 6pt;">proposed by @item.Proposer.FirstName @item.Proposer.LastName</span><br />
      <div style="margin: 10px 0px 10px 0px;">@item.ElevetorPitch</div>
      <span style="font-size: 6pt;">Technologies: @item.Technologies</span>
    </td>
  </tr>
  }
</table>
